﻿using System;
using System.Collections;
using UnityEngine;

// Token: 0x020002E0 RID: 736
public class TerrainTree : MonoBehaviour, IDestructible
{
	// Token: 0x0600110E RID: 4366 RVA: 0x0007E17C File Offset: 0x0007C37C
	public void Destroy(Vector3 contactPoint, float scale, bool secondary, bool debri, bool cheap = false)
	{
		if (this.fallen || scale < base.transform.lossyScale.y * 6f)
		{
			return;
		}
		this.fallen = true;
		Collider component = base.GetComponent<Collider>();
		if (component != null)
		{
			component.enabled = false;
		}
		base.StartCoroutine(this.FallCoroutine(contactPoint));
	}

	// Token: 0x0600110F RID: 4367 RVA: 0x0007E1E4 File Offset: 0x0007C3E4
	public IEnumerator FallCoroutine(Vector3 contactPoint)
	{
		Vector3 direction = base.transform.position - contactPoint;
		float y = Quaternion.LookRotation(direction).eulerAngles.y;
		Quaternion targetRotation = Quaternion.Euler(90f, y, 0f);
		while (base.transform.localRotation != targetRotation)
		{
			base.transform.localRotation = Quaternion.Lerp(base.transform.localRotation, targetRotation, 8f * Time.deltaTime);
			yield return null;
		}
		yield break;
	}

	// Token: 0x0400166D RID: 5741
	private bool fallen;
}
